package com.kk.factory.simplefactory;

/**
 * 简单工厂模式
 *
 * @author 王志强
 * @date 2021-12-10
 */
public class SimpleFactory {


    /**
     * 根据传参创建具体的对象
     */
    public AbstractPizza createPizza(String type) {

        AbstractPizza pizza = null;

        if ("greek".equals(type)) {
            pizza = new GreekPizza();
        } else if ("cheese".equals(type)) {
            pizza = new CheesePizza();
        }
        return pizza;
    }


}
